home *** CD-ROM | disk | FTP | other *** search
- type
- keyRec = record
- key theKey : string;
- theVal : string;
- endRecord
- endType
-
-
- var
- session : string = '';
- targetFile : string = '';
- itemID : string = '';
- ARec : keyRec;
- subs : table of keyRec;
- items : table of keyRec;
- subItems : byte;
- s : string;
- endVar;
-
- function strToInt(s : string) : longint;
- var
- r : real;
- endVar
- val(s, r);
- return r;
- endProc
-
- procedure main
- var
- si : integer;
- endVar
- session := fieldParm('SessionID');
- if ((session = '') or (session = '*SeSiOnId*'))
- getSession; { start a new session and load items table }
- else
- loadTable(items, session);
- endif;
- targetFile := cgiParm('Physical Path');
- itemID := fieldParm('ItemID');
- loadTable(subs, 'items.db');
- replaceState;
- ARec.theKey := itemID;
- setKeysFromRecord(subs, ARec);
- if (readRecord(subs, ARec))
- subItems := strToInt(ARec.theVal);
- for si := 1 to subItems do
- str(si : 0 : 0, s);
- ARec.theKey := itemID + s;
- setKeysFromRecord(items, ARec);
- if (readRecord(items, ARec))
- replaceInMemory('*' + ARec.theKey + '*', ARec.theVal);
- endif
- endFor
- endif
- writeFromMemory;
- endProc
-
- procedure getSession
- session := createTempFile;
- startSession; { generated by CatMake }
- endProc
-
- procedure replaceState
- rewriteOutput; { get read of automatic header }
- writeHTTPHeader('text/html');
- fileToMemory(targetFile);
- replaceInMemory('*SeSiOnId*', session);
- endProc
-